﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>限定文本框可输入字符数</title>
    <script type="text/javascript" language="JavaScript">
        function textcontrol(content){
            if(txt.length > 200){
                document.txt.value = document.txt.value.substring(0,200);   // 截取前200字符
            }
        }
        
    </script>
</head>
<body>
<textarea name="txt" cols="50" rows="10" onPropertyChange="textcontrol(txt.value)">
</textarea>
</body>
</html>